﻿<%@ Page Title="新闻中心" Language="C#" MasterPageFile="~/Admin/Site.Master" AutoEventWireup="true" CodeBehind="NewsList.aspx.cs" Inherits="PiaoanWeb.Admin.NewsList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table cellpadding="0px" cellspacing="0px" style="border: 0px; width: 990px; margin-left: auto; margin-right: auto; letter-spacing: 1px; line-height: 30px">
        <tr>
            <td align="center" style="background-color: rgb(111,189,102); font-size: 18px; font-weight: bold; font-family: 微软雅黑">新闻中心</td>
        </tr>
        <tr align="right" style="background-color:white">
            <td>
                <asp:Button ID="addNewsBtn" runat="server" Text="添加新闻" Style="width: 125px; height: 30px; text-align: center; color: white; letter-spacing: 1px; font-family: 微软雅黑; font-size: 14px; background-color: rgb(36, 115, 234); border-style: none;" OnClick="addNewsBtn_Click"  />&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="NewsGridView" runat="server" CssClass="table1" AllowPaging="true" PageSize="10"
                    AutoGenerateColumns="False" ItemType="PiaoanWeb.AppLogic.DataAccessLayer.News" OnRowDataBound="NewsGridView_RowDataBound" ShowHeaderWhenEmpty="True" OnPageIndexChanging="NewsGridView_PageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="序号">
                            <ItemTemplate>
                                <asp:Label ID="indexLbl" runat="server" Text=""></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Font-Bold="true"
                                Width="60px" Wrap="false" Height="30px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#FFFFFF" Width="60px"
                                Font-Bold="true" Height="30px"/>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="标题">
                            <ItemTemplate>
                                <asp:HyperLink ID="titleLbl" runat="server" Text='<%# Item.Title %>' Style="text-decoration: underline" NavigateUrl='<%# "ViewNews.aspx?NewsID="+Eval("ID")%>' Target="_self"></asp:HyperLink>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"
                                Width="300px" Wrap="false" />
                            <ItemStyle BackColor="White" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="发布日期">
                            <ItemTemplate>
                                <asp:Label ID="publishDateLbl" runat="server" Text='<%#Item.PublishDate.ToString("yyyy/MM/dd") %>' ></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"
                                Width="80px" Wrap="false" />
                            <ItemStyle BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:HyperLink ID="viewHyperLink" Width="40px" runat="server" Text="查看" Style="text-decoration: underline" NavigateUrl='<%# "ViewNews.aspx?NewsID="+Eval("ID")%>' Target="_self"></asp:HyperLink>&nbsp;&nbsp;
                                <asp:HyperLink ID="editNews" Width="40px" runat="server" Text="修改" Style="text-decoration: underline" NavigateUrl='<%# "EditNews.aspx?NewsID="+Eval("ID")%>' Target="_self"></asp:HyperLink>&nbsp;&nbsp;
                                <asp:LinkButton ID="deleteLnkBtn" Width="40px" runat="server" Text="删除" Style="text-decoration: underline" OnClick="deleteLnkBtn_Click" OnClientClick="javascript:return confirm('您确定要删除此条新闻吗？')" CommandArgument='<%# Item.ID%>'></asp:LinkButton>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"
                                Width="170px" Wrap="false" />
                            <ItemStyle Width="170px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#6fbd66" />
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Content>
